<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">

<head>
    <meta charset="UTF-8">
    <title>编辑</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8" />
    <link rel="stylesheet" href="../../static/css/font.css" th:href="@{/css/font.css}">
    <link rel="stylesheet" href="../../static/css/xadmin.css" th:href="@{/css/xadmin.css}">
    <link rel="stylesheet" href="../../static/css/all-member.css" th:href="@{/css/all-member.css}">
    <style>
        #block1,
        #block2,
        #block3 {
            left: -110px;
            width: 100%;
        }

        .star {
            color: red;
        }
    </style>
</head>

<body>
    <div style="overflow-y:scroll;" id="form-container">
        <form action="" class="layui-form layui-form-pane" th:if="${checkUser} != null" th:with="user=${checkUser}">
            <!--<div class="layui-form-item" style="position: relative;right:100px;top: 10px;">-->
            <!--</div>-->
            <div style="display: flex;">
                <div class="part">
                    <div class="layui-form-item">
                        <label class="layui-form-label"><i class="star">*&nbsp;</i>姓名:</label>
                        <div class="layui-input-inline">
                            <input type="text" name="name" autocomplete="off" class="layui-input"
                                th:value="${user.name != null}?${user.name}" lay-verify="required">
                        </div>
                        <label class="layui-form-label"><i class="star">*&nbsp;</i>性别:</label>
                        <div class="layui-input-inline">
                            <select name="gender" lay-filter="gender" lay-verify="required">
                                <option value="">请选择一个性别</option>
                                <option value="男" th:selected="${user.gender != null}?${user.gender}== '男'">男</option>
                                <option value="女" th:selected="${user.gender != null}?${user.gender}== '女'">女</option>
                            </select>
                        </div>
                    </div>
                    <!-- 第一行 -->
                    <div class="layui-form-item">
                        <label class="layui-form-label"><i class="star">*&nbsp;</i>出生日期:</label>
                        <div class="layui-input-inline">
                            <input name="birthday" id="birthday" type="text" autocomplete="off" class="layui-input"
                                th:value="${#dates.format(user.birthday,'yyyy-MM-dd')}" lay-verify="required">
                    </div>
                    <label class="layui-form-label"><i class="star">*&nbsp;</i>民族:</label>
                    <div class="layui-input-inline">
                        <select name="nation" lay-filter="nation" lay-verify="required" id="nation">
                            <option value="">请选择一个民族</option>
                            <!-- <option value="汉族" th:selected="${user.nation != null}?${user.nation}== '汉族'">汉族</option>
                            <option value="彝族" th:selected="${user.nation != null}?${user.nation}== '彝族'">彝族</option> -->
                        </select>
                    </div>
                </div>
                <!-- 第二行 -->
                <div class="layui-form-item">
                    <label class="layui-form-label">文化程度:</label>
                    <div class="layui-input-inline">
                        <select name="educationalLevel" lay-filter="educationalLevel">
                            <option value="">请选择文化程度</option>
                            <option value="小学" th:selected="${user.educationalLevel != null}?${user.educationalLevel}== '小学'">小学</option>
                            <option value="初中" th:selected="${user.educationalLevel != null}?${user.educationalLevel}== '初中'">初中</option>
                            <option value="高中" th:selected="${user.educationalLevel != null}?${user.educationalLevel}== '高中'">高中</option>
                            <option value="中专" th:selected="${user.educationalLevel != null}?${user.educationalLevel}== '中专'">中专</option>
                            <option value="大专" th:selected="${user.educationalLevel != null}?${user.educationalLevel}== '大专'">大专</option>
                            <option value="大学" th:selected="${user.educationalLevel != null}?${user.educationalLevel}== '大学'">大学</option>
                        </select>
                    </div>
                    <label class="layui-form-label">专业:</label>
                    <div class="layui-input-inline">
                        <input type="text" name="major"
                               autocomplete="off"
                               class="layui-input" th:value="${user.major != null}?${user.major}">
                    </div>
                </div>

                <!-- 第三行 -->
                <div class="layui-form-item">
                    <label class="layui-form-label"><i class="star">*&nbsp;</i>身份证号:</label>
                    <div class="layui-input-inline">
                        <input type="text" name="idCardNum"
                               autocomplete="off"
                               class="layui-input" th:value="${user.idCardNum != null}?${user.idCardNum}" lay-verify="required">
                    </div>
                    <label class="layui-form-label"><i class="star">*&nbsp;</i>政治面貌:</label>
                    <div class="layui-input-inline">
                        <select name="politicalStatus" lay-filter="politicalStatus" lay-verify="required">
                            <option value="">请选择政治面貌</option>
                            <option value="党员" th:selected="${user.politicalStatus != null}?${user.politicalStatus}== '党员'">党员</option>
                            <option value="群众" th:selected="${user.politicalStatus != null}?${user.politicalStatus}== '群众'">群众</option>
                            <option value="其他" th:selected="${user.politicalStatus != null}?${user.politicalStatus}== '其他'">其他</option>
                        </select>
                    </div>
                </div>

                <!-- 第四行 -->
                <div class="layui-form-item">
                    <label class="layui-form-label"><i class="star">*&nbsp;</i>手机号码:</label>
                    <div class="layui-input-inline">
                        <input type="text" name="phoneNum"
                               autocomplete="off"
                               class="layui-input" th:value="${user.phoneNum != null}?${user.phoneNum}" lay-verify="required">
                    </div>
                    <label class="layui-form-label">电子邮箱:</label>
                    <div class="layui-input-inline">
                        <input type="text" name="email"
                               autocomplete="off"
                               class="layui-input" th:value="${user.email != null}?${user.email}">
                    </div>
                </div>
            </div>


            <div class="layui-input-block" style="position: relative;">
                <button id="upload1" type="button"
                        style="position:absolute;opacity:0;height:160px;width:120px;"></button>
                <button id="hideupload1" type="button" class="layui-hide"></button>
                <img id="imgPhoto" src="" style="width:120px;height:160px;" th:src="${user.faceImage != null}?${user.faceImage}">
            </div>
        </div>

        <!-- 第五行 -->
        <div class="layui-form-item">
            <label class="layui-form-label">QQ号:</label>
            <div class="layui-input-inline">
                <input type="text" name="qqNum"
                       autocomplete="off"
                       class="layui-input" th:value="${user.qqNum != null}?${user.qqNum}">
            </div>
            <label class="layui-form-label">微信号:</label>
            <div class="layui-input-inline">
                <input type="text" name="wechatNum"
                       autocomplete="off"
                       class="layui-input" th:value="${user.weChatNum != null}?${user.weChatNum}">
            </div>
        </div>

        <!-- 第六行 -->
        <div class="layui-form-item">
            <label class="layui-form-label" style="padding: 8px 5px;"><i class="star">*&nbsp;</i>户籍所在地:</label>
            <div class="layui-input-inline" style="width: 180px;">
                <select name="province" id="province" lay-filter="province" lay-verify="required">
                    <option value="">请选择省</option>
                     <!-- <option th:if="${user.province != null}" th:value="${user.province}" th:text="${user.province}"></option> -->
                     <!-- <option th:unless="${user.province != null}" value="">请选择省份</option> -->
                     <!--<option value="上海" th:selected="${user.province != null}?${user.province}== '上海'">上海</option>
                    <option value="四川" th:selected="${user.province != null}?${user.province}== '四川'">四川</option> -->
                </select>
            </div>
            <div class="layui-input-inline" style="width: 180px;">
                <select name="city" id="city" lay-filter="city" lay-verify="required">
                    <option value="">请选择市</option>
                    <!-- <option value="1" th:selected="${user.city != null}?${user.city}== '1'">1</option>
                    <option value="2" th:selected="${user.city != null}?${user.city}== '2'">2</option>
                    <option value="3" th:selected="${user.city != null}?${user.city}== '3'">3</option> -->
                </select>
            </div>
            <div class="layui-input-inline" style="width: 180px;">
                <select name="district" id="district" lay-filter="district" lay-verify="required">
                    <option value="">请选择区</option>
                    <!-- <option value="1" th:selected="${user.district != null}?${user.district}== '1'">1</option>
                    <option value="2" th:selected="${user.district != null}?${user.district}== '2'">2</option>
                    <option value="3" th:selected="${user.district != null}?${user.district}== '3'">3</option> -->
                </select>
            </div>
            <div class="layui-input-inline" style="width: 180px;">
                <select name="town" id="town" lay-filter="town" lay-verify="required">
                    <option value="">请选择镇</option>
                    <!-- <option value="1" th:selected="${user.town != null}?${user.town}== '1'">1</option>
                    <option value="2" th:selected="${user.town != null}?${user.town}== '2'">2</option>
                    <option value="3" th:selected="${user.town != null}?${user.town}== '3'">3</option> -->
                </select>
            </div>
        </div>

        <!--第七行-->
        <div class="layui-form-item">
            <label class="layui-form-label"><i class="star">*&nbsp;</i>通讯地址:</label>
            <div class="layui-input-block">
                <input lay-verify="required" type="text" name="address"
                       autocomplete="off" class="layui-input" th:value="${user.address != null}?${user.address}">
            </div>
        </div>

        <!-- 第八行 -->
        <div class="layui-form-item">
            <label class="layui-form-label"><i class="star">*&nbsp;</i>人员类别:</label>
            <div class="layui-input-inline" lay-filter="select-user-type">
                <select name="userType" id="userType" lay-verify="required">
                        <option value="">请选择人员类别</option>
                    <option th:each="type:${allUserType}" th:value="${type.userTypeName}" th:text="${type.userTypeName}" th:selected="${user.userType.id == type.id}" th:attr="data-desc=${type.description},data-id=${type.id}"></option>
                </select>
            </div>
            <label class="layui-form-label"><i class="star">*&nbsp;</i>申请方式:</label>
            <div class="layui-input-inline">
                <select name="applicationMethod" id="applicationMethod" lay-verify="required">
                    <option value="">请选择申请方式</option>
                    <option th:each="applicationMethod:${allApplicationMethod}" th:value="${applicationMethod.applicationMethodName}" th:text="${applicationMethod.applicationMethodName}" th:selected="${user.applicationMethod.id == applicationMethod.id}" th:attr="data-desc=${applicationMethod.description},data-id=${applicationMethod.id}"></option>
                </select>
            </div>
        </div>


        <!--第九行-->
        <div class="layui-form-item">
            <label class="layui-form-label"
                   style="height: 114px;padding: 8px 10px;line-height: 114px;vertical-align: middle">学习培训经历:</label>
            <div class="layui-input-block">
                <label class="layui-form-label"
                       style="height: 76px;line-height: 76px;vertical-align: middle">地方培训:</label>
                <div class="layui-input-block">
                    <div class="layui-form-mid" style="margin-right: 5px">是否参加地方农业培训</div>
                    <div class="layui-input-inline" style="width: 160px">
                        <select name="isAttendLocalTraining" class="local">
                            <option value="">请选择是否参加</option>
                            <option value="true" th:selected="${user.isAttendLocalTraining == true}">是</option>
                            <option value="false" th:selected="${user.isAttendLocalTraining == false}">否</option>
                        </select>
                    </div>
                    <div class="layui-form-mid" style="margin-right: 5px">,平均每年参加地方培训</div>
                    <div class="layui-input-inline" style="width: 160px">
                        <select name="localTrainingTimes" class="local">
                            <option value="">请选择次数</option>
                            <option value="1" th:selected="${user.localTrainingTimes == 1}">1</option>
                            <option value="2" th:selected="${user.localTrainingTimes == 2}">2</option>
                        </select>
                    </div>
                </div>
                <div class="layui-input-block">
                    <input type="text" name="localTrainingDescription" autocomplete="off" class="layui-input" th:value="${user.localTrainingDescription != null}?${user.localTrainingDescription}">
                </div>
                <label class="layui-form-label">国家培训:</label>
                <div class="layui-input-block">
                    <input type="text" name="nationalTrainingDescription" autocomplete="off" class="layui-input" th:value="${user.nationalTrainingDescription != null}?${user.nationalTrainingDescription}">
                </div>
            </div>
        </div>

        <!--第十行-->
        <div class="layui-form-item">
            <label class="layui-form-label" style="padding: 8px 5px"><i class="star">*&nbsp;</i>获奖证书情况:</label>
            <div class="layui-input-block">
                <select lay-verify="required" name="certificates" class="local" id="certificates" th:each="userCertificate:${user.certificates}">
                    <option value="">请选择获奖证书情况</option>
                    <option th:each="certificate:${allCertificate}" th:value="${certificate.certificateName}" th:text="${certificate.certificateName}" th:selected="${userCertificate.id == certificate.id}" th:attr="data-desc=${certificate.description},data-id=${certificate.id}">请选择获奖证书情况</option>
                </select>
            </div>
        </div>

        <!--第十一行-->
        <div class="layui-form-item">
            <label class="layui-form-label"><i class="star">*&nbsp;</i>认定情况:</label>
            <div class="layui-input-inline">
                <select name="identification" lay-filter="culture" lay-verify="required">
                    <option value="">请选择认定情况</option>
                    <option value="true" th:selected="${user.identification == true}">已认定</option>
                    <option value="false" th:selected="${user.identification == false}">未认定</option>
                </select>
            </div>
            <label class="layui-form-label" style="width:190px;">新型职业农民证书编号:</label>
            <div class="layui-input-inline">
                <input type="text" name="identificationNum"
                       autocomplete="off"
                       class="layui-input" th:value="${user.identificationNum != null}?${user.identificationNum}">
            </div>
            <!--<div class="layui-form-mid">辅助文字</div>-->
        </div>

        <!--第十二行-->
        <div class="layui-form-item">
            <label class="layui-form-label">类型变更:</label>
            <div class="layui-input-block">
                <select name="typeChange" class="local">
                    <option value="">请选择类型变更</option>
                    <option value="类型1" th:selected="${user.typeChange == '类型1'}">类型1</option>
                    <option value="类型2" th:selected="${user.typeChange == '类型2'}">类型2</option>
                </select>
            </div>
        </div>
      
        <div class="layui-form-item" th:with="industryBasicInfor=${user.industryBaseInfo}">
            <span class="layui-form-label" style="height: 492px;padding: 8px 30px;white-space: normal;">农业生产经营和服务基本情况</span>
            <div class="layui-input-block">
                <span class="layui-form-label">产业所在地</span>
                <div class="layui-input-block">
                    <input class="layui-input" type="text" name="industryDirection"
                           autocomplete="off" th:value="${industryBasicInfor.industryDirection != null}?${industryBasicInfor.industryDirection}"/>
                </div>
                <div class="layui-input-block" style="left:-110px;width: 100%;text-align: center;line-height:36px;vertical-align: middle;">主体产业</div>
                <div th:each="industry:${industryBasicInfor.industries}">
                    <div class="layui-input-block" style="left:-110px;width: 100%">
                        <span class="layui-form-label" style="width: 85px;padding: 8px 8px" th:text="'主体产业'+${industryStat.count}">主体产业1</span>
                        <div class="layui-input-inline" style="width: 105px;margin-right: 2px">
                            <input class="layui-input" type="text" name="industryType_1"
                                   autocomplete="off" style="padding-left: 7px" th:value="${industry.industryType}"/>
                        </div>
                        <span class="layui-form-label" style="width: 85px;padding: 8px 8px">产业名称</span>
                        <div class="layui-input-inline" style="width: 105px;margin-right: 2px">
                            <input class="layui-input" type="text" name="industryName_1"
                                   autocomplete="off" style="padding-left: 7px" th:value="${industry.industryName}"/>
                        </div>
                        <span class="layui-form-label" style="width: 85px;padding: 8px 8px">产业规模</span>
                        <div class="layui-input-inline" style="width: 105px;margin-right: 2px">
                            <input class="layui-input" type="text" name="industryScale_1"
                                   autocomplete="off" style="padding-left: 7px" th:value="${industry.industryScale}"/>
                        </div>
                        <span class="layui-form-label" style="width: 85px;padding: 8px 8px">从事年限</span>
                        <div class="layui-input-inline" style="width: 105px;margin-right: 2px">
                            <input class="layui-input" type="text" name="year_1"
                                   autocomplete="off" style="padding-left: 7px" th:value="${industry.year}"/>
                        </div>
                    </div>
                </div>
                <div class="layui-input-block" id="block1" th:style="'display:' + @{(${#lists.size(industryBasicInfor.industries)} eq 0?'block':'none')} + ''">
                    <span class="layui-form-label" style="width: 85px;padding: 8px 8px">主体产业1</span>
                    <div class="layui-input-inline" style="width: 105px;margin-right: 2px">
                        <input class="layui-input" type="text" name="industryType_1"
                               autocomplete="off" style="padding-left: 7px"/>
                    </div>
                    <span class="layui-form-label" style="width: 85px;padding: 8px 8px">产业名称</span>
                    <div class="layui-input-inline" style="width: 105px;margin-right: 2px">
                        <input class="layui-input" type="text" name="industryName_1"
                               autocomplete="off" style="padding-left: 7px"/>
                    </div>
                    <span class="layui-form-label" style="width: 85px;padding: 8px 8px">产业规模</span>
                    <div class="layui-input-inline" style="width: 105px;margin-right: 2px">
                        <input class="layui-input" type="text" name="industryScale_1"
                               autocomplete="off" style="padding-left: 7px"/>
                    </div>
                    <span class="layui-form-label" style="width: 85px;padding: 8px 8px">从事年限</span>
                    <div class="layui-input-inline" style="width: 105px;margin-right: 2px">
                        <input class="layui-input" type="text" name="year_1"
                               autocomplete="off" style="padding-left: 7px"/>
                    </div>
                </div>
                 <div class="layui-input-block" id="block2" th:style="'display:' + @{(${#lists.size(industryBasicInfor.industries)} < 2?'block':'none')} + ''">
                    <span class="layui-form-label" style="width: 85px;padding: 8px 8px">主体产业2</span>
                    <div class="layui-input-inline" style="width: 105px;margin-right: 2px">
                        <input class="layui-input" type="text" name="industryType_2"
                               autocomplete="off" style="padding-left: 7px"/>
                    </div>
                    <span class="layui-form-label" style="width: 85px;padding: 8px 8px">产业名称</span>
                    <div class="layui-input-inline" style="width: 105px;margin-right: 2px">
                        <input class="layui-input" type="text" name="industryName_2"
                               autocomplete="off" style="padding-left: 7px"/>
                    </div>
                    <span class="layui-form-label" style="width: 85px;padding: 8px 8px">产业规模</span>
                    <div class="layui-input-inline" style="width: 105px;margin-right: 2px">
                        <input class="layui-input" type="text" name="industryScale_2"
                               autocomplete="off" style="padding-left: 7px"/>
                    </div>
                    <span class="layui-form-label" style="width: 85px;padding: 8px 8px">从事年限</span>
                    <div class="layui-input-inline" style="width: 105px;margin-right: 2px">
                        <input class="layui-input" type="text" name="year_2"
                               autocomplete="off" style="padding-left: 7px"/>
                    </div>
                </div>
                
                <div class="layui-input-block" id="block3" th:style="'display:' + @{(${#lists.size(industryBasicInfor.industries)} < 3?'block':'none')} + ''">
                    <span class="layui-form-label" style="width: 85px;padding: 8px 8px">主体产业3</span>
                    <div class="layui-input-inline" style="width: 105px;margin-right: 2px">
                        <input class="layui-input" type="text" name="industryType_3"
                               autocomplete="off" style="padding-left: 7px"/>
                    </div>
                    <span class="layui-form-label" style="width: 85px;padding: 8px 8px">产业名称</span>
                    <div class="layui-input-inline" style="width: 105px;margin-right: 2px">
                        <input class="layui-input" type="text" name="industryName_3"
                               autocomplete="off" style="padding-left: 7px"/>
                    </div>
                    <span class="layui-form-label" style="width: 85px;padding: 8px 8px">产业规模</span>
                    <div class="layui-input-inline" style="width: 105px;margin-right: 2px">
                        <input class="layui-input" type="text" name="industryScale_3"
                               autocomplete="off" style="padding-left: 7px"/>
                    </div>
                    <span class="layui-form-label" style="width: 85px;padding: 8px 8px">从事年限</span>
                    <div class="layui-input-inline" style="width: 105px;margin-right: 2px">
                        <input class="layui-input" type="text" name="year_3"
                               autocomplete="off" style="padding-left: 7px"/>
                    </div>
                </div>
                <div class="layui-input-block" style="left: -110px;width: 100%">
                    <span class="layui-form-label" style="padding: 8px 3px;">上年度产业收入</span>
                    <div class="layui-input-block">
                        <input class="layui-input" type="text" name="incomeOfLastYear_industry" autocomplete="off" th:value="${industryBasicInfor.incomeOfLastYear}"/>
                    </div>
                </div>
                <div class="layui-input-block" style="margin-left: 0;width: 100%">
                    <span class="layui-form-label" name="familyFarmInfo" style="height: 152px;padding: 8px 3px;">家庭农场情况</span>
                    <div class="layui-input-block">
                        <span class="layui-form-label" style="padding: 8px 3px;">是否登记注册</span>
                        <div class="layui-input-inline">
                            <select name="register">
                                <option value="">请选择是否注册</option>
                                <option value="true" th:selected="${user.industryBaseInfo.familyFarmInfo.register == true}">是</option>
                                <option value="false" th:selected="${user.industryBaseInfo.familyFarmInfo.register == false}">否</option>
                            </select>
                        </div>
                        <span class="layui-form-label" style="padding: 8px 3px;">示范性家庭农场</span>
                        <div class="layui-input-inline">
                            <select name="exemplaryFarm">
                                <option value="">请选择是否为</option>
                                <option value="true" th:selected="${user.industryBaseInfo.familyFarmInfo.exemplaryFarm == true}">是</option>
                                <option value="false" th:selected="${user.industryBaseInfo.familyFarmInfo.exemplaryFarm == false}">否</option>
                            </select>
                        </div>
                    </div>
                    <div class="layui-input-block">
                        <span class="layui-form-label" style="padding: 8px 3px;">家庭农场类型</span>
                        <div class="layui-input-block">
                            <input name="farmType" class="layui-input" type="text" autocomplete="off" th:value="${user.industryBaseInfo.familyFarmInfo !=null}?${user.industryBaseInfo.familyFarmInfo.farmType}">
                        </div>
                    </div>
                    <div class="layui-input-block">
                        <span class="layui-form-label" style="padding: 8px 3px;">土地经营规模</span>
                        <div class="layui-input-inline">
                            <input name="landManagementScale" class="layui-input" type="text" autocomplete="off" th:value="${user.industryBaseInfo.familyFarmInfo !=null}?${user.industryBaseInfo.familyFarmInfo.landManagementScale}">
                        </div>
                        <span class="layui-form-label">家庭总人口</span>
                        <div class="layui-input-inline">
                            <input name="population" class="layui-input" type="text" autocomplete="off" th:value="${user.industryBaseInfo.familyFarmInfo !=null}?${user.industryBaseInfo.familyFarmInfo.population}">
                        </div>
                    </div>
                    <div class="layui-input-block">
                        <span class="layui-form-label" style="padding: 8px 3px;width:120px">家庭从事产业人数</span>
                        <div class="layui-input-inline" style="width: 180px;">
                            <input name="engagedNum" class="layui-input" type="text" autocomplete="off" th:value="${user.industryBaseInfo.familyFarmInfo !=null}?${user.industryBaseInfo.familyFarmInfo.engagedNum}">
                        </div>
                        <span class="layui-form-label" style="padding: 8px 3px;">上年度家庭收入</span>
                        <div class="layui-input-inline">
                            <input name="incomeOfLastYear_family" class="layui-input" type="text" autocomplete="off" th:value="${user.industryBaseInfo.familyFarmInfo !=null}?${user.industryBaseInfo.familyFarmInfo.incomeOfLastYear}">
                        </div>
                    </div>


                    <div class="layui-input-block" style="left: -110px">
                        <span class="layui-form-label">工作地点</span>
                        <div class="layui-input-block">
                            <input name="workAddress" class="layui-input" type="text" autocomplete="off" th:value="${user.industryBaseInfo !=null}?${user.industryBaseInfo.workAddress}">
                        </div>
                    </div>
                    <div class="layui-input-block" style="left: -110px">
                        <span class="layui-form-label">服务对象</span>
                        <div class="layui-input-inline">
                            <input name="serviceTarget" class="layui-input" type="text" autocomplete="off" th:value="${user.industryBaseInfo !=null}?${user.industryBaseInfo.serviceTarget}">
                        </div>
                        <span class="layui-form-label">服务规模</span>
                        <div class="layui-input-inline">
                            <input name="serviceCount" class="layui-input" type="text" autocomplete="off" th:value="${user.industryBaseInfo !=null}?${user.industryBaseInfo.serviceCount}">
                        </div>
                    </div>
                    <div class="layui-input-block" style="left: -110px">
                        <span class="layui-form-label">从业年限</span>
                        <div class="layui-input-inline">
                            <input name="year_total" class="layui-input" type="text" autocomplete="off" th:value="${user.industryBaseInfo !=null}?${user.industryBaseInfo.year}">
                        </div>
                        <span class="layui-form-label">年收入</span>
                        <div class="layui-input-inline">
                            <input name="income_total" class="layui-input" type="text" autocomplete="off" th:value="${user.industryBaseInfo !=null}?${user.industryBaseInfo.income}">
                        </div>

                    </div>
                </div>
            </div>
        </div>

        <div class="layui-form-item">
            <div class="layui-input-block" style="float:right;padding-right: 20px">
                <button class="layui-btn" lay-submit lay-filter="formUpdate">提交</button>
                <button type="reset" class="layui-btn layui-btn-primary">重置</button>
            </div>
        </div>
    </form>
</div>

<script type="text/javascript" src="../../static/lib/layui/layui.js" charset="utf-8"
        th:src="@{/lib/layui/layui.js}"></script>
<script type="text/javascript" src="../../static/js/xadmin.js" th:src="@{/js/xadmin.js}"></script>
<script type="text/javascript" src="../../static/js/jquery.min.js" th:src="@{/js/jquery.min.js}"></script>
<!--[if lt IE 9]>
<script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
<script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<script th:inline="NONE">
    var href = window.location.href.split('&')[0];
    console.log(href);
    var memberId = href.match(/\=(.*)/)[1];
    console.log(memberId);


    $('#form-container').css('height', $(window).height() + 'px');

    function child(obj) {
        console.log(obj);//获取父界面的传值
    }
    layui.use(['form', 'table', 'laydate', 'layer'], function () {
        var memberProvince;
        var memberCity;
        var memberDistrict;
        var memberTown;
        var form = layui.form;
        var laydate = layui.laydate;
        var layer = layui.layer;
        var nations = ["汉族", "蒙古族", "回族", "藏族", "维吾尔族", "苗族", "彝族", "壮族", "布依族", "朝鲜族", "满族", "侗族", "瑶族", "白族",
		"土家族", "哈尼族", "哈萨克族", "傣族", "黎族", "傈僳族", "佤族", "畲族", "高山族", "拉祜族", "水族", "东乡族", "纳西族", "景颇族", "柯尔克孜族", "土族", 
		"达斡尔族", "仫佬族", "羌族", "布朗族", "撒拉族", "毛南族", "仡佬族", "锡伯族", "阿昌族", "普米族", "塔吉克族", "怒族", "乌孜别克族", "俄罗斯族", "鄂温克族", 
		"德昂族", "保安族", "裕固族", "京族", "塔塔尔族", "独龙族", "鄂伦春族", "赫哲族", "门巴族", "珞巴族", "基诺族"];
        
        laydate.render({
            elem: '#birthday'
        });
        $.ajax({
            url: '/v1/user/selectUserById?userId=' + memberId,
            type: 'GET',
            async: "false",
            success: function (res) {
                console.log(res);
                memberProvince = res.data.province;
                memberCity = res.data.city;
                memberDistrict = res.data.district;
                memberTown = res.data.town;
                var memberNation = res.data.nation

                var res = JSON.parse(sessionStorage.getItem('province'));
                var length = res.districts[0].districts.length;

                for (var i = 0; i < length; i++) {
                    $("#province").append(
                        "<option value=\"" + res.districts[0].districts[i].name + "\" >" + res.districts[0].districts[i].name + "</option>"
                    );
                }
                if(memberProvince){
                    $("#province").find("option[value=" + memberProvince + "]").attr("selected", true);
                }
                for(var item of nations){
                    $("#nation").append(
                        "<option value=\"" + item + "\" >" + item + "</option>"
                    );
                }
                if(memberNation){
                    $("#nation").find("option[value=" + memberNation + "]").attr("selected", true);
                }
                form.render('select')
                
                function renderLocation(lastLocation, thisLocation, thisSelector, cb) {
                    $.ajax({
                        url: "https://restapi.amap.com/v3/config/district?key=e9b4199596ccf074d1480b0236a60b06&subdistrict=1&keywords=" + lastLocation,
                        type: "GET",
                        success: function (res) {
                            var length = res.districts[0].districts.length;
                            for (var i = 0; i < length; i++) {
                                $(thisSelector).append(
                                    "<option value=\"" + res.districts[0].districts[i].name + "\" >" + res.districts[0].districts[i].name + "</option>"
                                );
                            }
                            if (thisLocation) {
                                $(thisSelector).find("option[value=" + thisLocation + "]").attr("selected", true);
                            }
                            form.render('select');
                            cb();
                        }
                    })
                }
                renderLocation(memberProvince, memberCity, '#city', function () {
                    renderLocation(memberCity, memberDistrict, '#district', function () {
                        renderLocation(memberDistrict, memberTown, '#town');
                    })
                })

                // $.ajax({
                //     url: "https://restapi.amap.com/v3/config/district?key=e9b4199596ccf074d1480b0236a60b06&subdistrict=1&keywords=" + memberProvince,
                //     type: "GET",
                //     success: function (res) {
                //         console.log("memberCity", memberCity);
                //         var length = res.districts[0].districts.length;
                //         console.log("length", length);

                //         for (var i = 0; i < length; i++) {
                //             $("#city").append(
                //                 "<option value=\"" + res.districts[0].districts[i].name + "\" >" + res.districts[0].districts[i].name + "</option>"
                //             );
                //         }
                //         if (memberCity) {
                //             $("#city").find("option[value=" + memberCity + "]").attr("selected", true);
                //         }
                //         form.render('select');
                //         $.ajax({
                //             url: "https://restapi.amap.com/v3/config/district?key=e9b4199596ccf074d1480b0236a60b06&subdistrict=1&keywords=" + memberCity,
                //             type: "GET",
                //             success: function (res) {
                //                 console.log("memberDistrict", memberDistrict);
                //                 var length = res.districts[0].districts.length;
                //                 console.log("length", length);

                //                 for (var i = 0; i < length; i++) {
                //                     $("#district").append(
                //                         "<option value=\"" + res.districts[0].districts[i].name + "\" >" + res.districts[0].districts[i].name + "</option>"
                //                     );
                //                 }
                //                 if (memberDistrict) {
                //                     $("#district").find("option[value=" + memberDistrict + "]").attr("selected", true);
                //                 }
                //                 form.render('select');
                //                 $.ajax({
                //                     url: "https://restapi.amap.com/v3/config/district?key=e9b4199596ccf074d1480b0236a60b06&subdistrict=1&keywords=" + memberDistrict,
                //                     type: "GET",
                //                     success: function (res) {
                //                         console.log("memberTown", memberTown);
                //                         var length = res.districts[0].districts.length;
                //                         console.log("length", length);

                //                         for (var i = 0; i < length; i++) {
                //                             $("#town").append(
                //                                 "<option value=\"" + res.districts[0].districts[i].name + "\" >" + res.districts[0].districts[i].name + "</option>"
                //                             );
                //                         }
                //                         if (memberTown) {
                //                             $("#town").find("option[value=" + memberTown + "]").attr("selected", true);
                //                         }
                //                         form.render('select')

                //                     }, error: function (res) {
                //                         console.log("失败了");
                //                     }
                //                 })

                //             }, error: function (res) {
                //                 console.log("失败了");
                //             }
                //         })

                //     }, error: function (res) {
                //         console.log("失败了");
                //     }
                // })

            }, error: function (res) {
                console.log(res);
            }
        })

        function changeLocation(thisIdSelector, thisLocation, nextIdSelector, nextLocation) {
            form.on(thisIdSelector, function (data) {
                // category = data.value;
                thisLocation = data.elem[data.elem.selectedIndex].text;
                console.log(thisLocation);
                $.ajax({
                    url: "https://restapi.amap.com/v3/config/district?key=e9b4199596ccf074d1480b0236a60b06&subdistrict=1&keywords=" + thisLocation,
                    type: "GET",
                    success: function (res) {
                        var length = res.districts[0].districts.length;
                        console.log("length", length);
                        $(nextIdSelector).empty();
                        for (var i = 0; i < length; i++) {
                            $(nextIdSelector).append(
                                "<option value=\"" + res.districts[0].districts[i].name + "\" >" + res.districts[0].districts[i].name + "</option>"
                            );
                        }
                        nextLocation = $(nextIdSelector).find("option:selected").text();
                        console.log("nextLocation", nextLocation);
                        form.render('select');

                    }, error: function (res) {
                        console.log("失败了");
                    }
                })
                form.render('select');
            })
        }

        changeLocation('select(province)', memberProvince, '#city', memberCity);
        changeLocation('select(city)', memberCity, '#district', memberDistrict);
        changeLocation('select(district)', memberDistrict, '#town', memberTown);

        form.on('submit(formUpdate)', function (data) {
            console.log($('#user-type'));
            console.log(JSON.stringify(data.field));
            var data = data.field;
            console.log("//=================");
            console.log(data);
            var newData = data;
            console.log(newData);
            function newObject(keyName, selector, selectName) {
                var res = {};
                if (data[selectName]) {
                    res[keyName] = $(selector).attr("value");
                    res.description = $(selector).attr("data-desc");
                    res.id = $(selector).attr("data-id");
                }
                return res;
            }
            var applicationMethod = newObject("applicationMethodName", "#applicationMethod option:selected", "applicationMethod");
            var certificates = newObject("certificatesName", "#certificates option:selected", "certificates");
            var userType = newObject("userTypeName", "#userType option:selected", "userType");
            console.log("applicationMethod", applicationMethod);
            console.log("certificates", certificates);
            console.log("userType", userType);
            var industryBaseInfo = {};
            var familyFarmInfo = {};
            familyFarmInfo.engagedNum = data.engagedNum ? parseInt(data.engagedNum) : null;
            familyFarmInfo.exemplaryFarm = data.exemplaryFarm ? JSON.parse(data.exemplaryFarm) : null;
            familyFarmInfo.farmType = data.farmType ? data.farmType : "";
            familyFarmInfo.incomeOfLastYear = data.incomeOfLastYear_family ? parseInt(data.incomeOfLastYear_family) : null;
            familyFarmInfo.landManagementScale = data.landManagementScale ? parseInt(data.landManagementScale) : null;
            familyFarmInfo.register = data.register ? JSON.parse(data.register) : null;
            familyFarmInfo.population = data.population ? parseInt(data.population) : null;
            var industries = [];
            var industry1 = {}, industry2 = {}, industry3 = {};
            if (data.industryType_1) {
                industry1.industryName = data.industryName_1;
                industry1.industryScale = data.industryScale_1 ? parseInt(data.industryScale_1) : null;
                industry1.industryType = data.industryType_1;
                industry1.year = data.year_1 ? parseInt(data.year_1) : null;
                industries.push(industry1)
            }
            if (data.industryType_2) {
                industry2.industryName = data.industryName_2;
                industry2.industryScale = data.industryScale_2 ? parseInt(data.industryScale_2) : null;
                industry2.industryType = data.industryType_2;
                industry2.year = data.year_2 ? parseInt(data.year_2) : null;
                industries.push(industry2)
            }
            if (data.industryType_3) {
                industry3.industryName = data.industryName_3;
                industry3.industryScale = data.industryScale_3 ? parseInt(data.industryScale_3) : null;
                industry3.industryType = data.industryType_3;
                industry3.year = data.year_3 ? parseInt(data.year_3) : null;
                industries.push(industry3)
            }
            industryBaseInfo.familyFarmInfo = familyFarmInfo;
            industryBaseInfo.industries = industries;
            industryBaseInfo.income = data.income_total ? parseInt(data.income_total) : null;
            industryBaseInfo.incomeOfLastYear = data.incomeOfLastYear_industry ? data.incomeOfLastYear_industry : null;
            industryBaseInfo.industryDirection = data.industryDirection ? data.industryDirection : "";
            industryBaseInfo.serviceCount = data.serviceCount ? parseInt(data.serviceCount) : null;
            industryBaseInfo.serviceTarget = data.industryDirection ? data.industryDirection : "";
            industryBaseInfo.workAddress = data.workAddress ? data.workAddress : "";
            industryBaseInfo.year = data.year_total ? parseInt(data.year_total) : null;

            var tempArr = [];
            tempArr.push(certificates);
            newData.id = memberId;
            newData.identification = data.identification ? JSON.parse(data.identification) : null;
            newData.industryBaseInfo = industryBaseInfo;
            newData.applicationMethod = applicationMethod;
            newData.certificates = tempArr;
            newData.userType = userType;
            newData.faceImage = "";
            newData.nationalTrainingTimes = 0;
            newData.localTrainingTimes = newData.localTrainingTimes ? parseInt(newData.localTrainingTimes) : null;
            newData.isAttendLocalTraining = newData.isAttendLocalTraining ? JSON.parse(newData.isAttendLocalTraining) : null;
            delete newData.incomeOfLastYear_industry;
            delete newData.income_total;
            delete newData.incomeOfLastYear_family;
            delete newData.year_total;
            delete newData.year_1;
            delete newData.year_2;
            delete newData.year_3;
            delete newData.industryType_1;
            delete newData.industryType_2;
            delete newData.industryType_3;
            delete newData.industryName_1;
            delete newData.industryName_2;
            delete newData.industryName_3;
            delete newData.industryScale_1;
            delete newData.industryScale_2;
            delete newData.industryScale_3;
            delete newData.engagedNum;
            delete newData.exemplaryFarm;
            delete newData.farmType;
            delete newData.landManagementScale;
            delete newData.register;
            delete newData.industryDirection;
            delete newData.workAddress;
            delete newData.serviceTarget;
            delete newData.serviceCount;
            delete newData.population;


            console.log("newData", newData);

            console.log("newData字符串", JSON.stringify(newData));

            $.ajax({
                url: '/v1/user/updateUser',
                contentType: 'application/json',
                type: 'POST',
                async: false,
                data: JSON.stringify(newData),
                success: function (res) {
                    console.log("更新成功了");
                    layer.msg("更新成功");
                    var index = parent.layer.getFrameIndex(window.name);
                    console.log("index",index)
                    // setTimeout(function(){
                    //     parent.layer.close(index);
                    //     parent.location.reload;
                    // },2000);
                }, error: function (res) {
                    console.log("失败", res);
                    layer.msg("更新失败");
                }, complete: function (res) {
                    console.log("完成", res);
                }
            })
        })

    })

</script>
</body>
</html>